<script lang="ts" setup>
import { readDir, BaseDirectory } from '@tauri-apps/plugin-fs';
// 读取目录中的所有文件和子目录
const fileList: any = ref([])
onMounted(async () => {
    const result = await readDir('Downloads', {
        baseDir: BaseDirectory.Home
    })
    console.log('目录下的文件列表', result)
    fileList.value = result
})
</script>
<template>
    <div class="main">
        <el-space :size="32" wrap>
            <el-link v-for="file in fileList" type="primary">{{ file.name }}</el-link>
        </el-space>
    </div>
</template>
<style lang="scss" scoped>
.main {
    width: 100%;
    height: 100vh;
    padding: 20px;
}
</style>